Skip to content

Add support for SqsTemplate to send more than 10 messages at once - #1659

Open
joseiedo wants to merge 11 commits into
awspring:mainfrom
joseiedo:main
Open

Add support for SqsTemplate to send more than 10 messages at once#1659
joseiedo wants to merge 11 commits into
awspring:mainfrom
joseiedo:main

Conversation

@joseiedo

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

AWS SDK doesn't have support to send a batch of messages of more than 10 items. This PR add an alternative where the received batch is partitioned in smaller batches of 10. For FIFO queues the batches are sent sequentially (if one fails, the others aren't sent), while for non-FIFO they are parallelized.

💡 Motivation and Context

solves #1042

💚 How did you test it?

I added integration test and unit tests with a sample.

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • I updated reference documentation to reflect the change
  • All tests passing
  • No breaking changes

🔮 Next steps

Check if there's concerns with this approach and update documentation explaining how this works in order to make it clear for users.

joseiedo and others added 2 commits July 24, 2026 20:05
Add more tests

simplifying tests

stop sequential send when a failure occurs

@tomazfernandes tomazfernandes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @joseiedo. I see you're still pushing commits, so I'll leave just one comment about the partitioning strategy. Let me know your thoughts.

int totalSize = messagesToUse.size();
return IntStream.rangeClosed(0, (totalSize - 1) / pageSize)
.mapToObj(index -> messagesToUse.subList(index * pageSize, Math.min((index + 1) * pageSize, totalSize)))
.mapToObj(index -> (Collection<T>) messagesToUse.subList(index * pageSize, Math.min((index + 1) * pageSize, totalSize)))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why suddenly this was happening, but the pipeline couldn't compile successfully if I didn't used this cast.

https://github.com/awspring/spring-cloud-aws/actions/runs/30174435089/job/89720833992

@joseiedo

Copy link
Copy Markdown
Contributor Author

Hi @tomazfernandes

I added a binpack algorithm here, let me know your thoughts about it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: sqs SQS integration related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants